{extend name="base" /}
{block name="title"}
<title>我的</title>
<link rel="stylesheet" href="/html/layer_mobile/need/layer.css?2.0">
<script src="/html/layer_mobile/layer.js"></script>
{/block}
{block name="content"}
<body style="background:#FFFFFF">
<div class="my-banner">
    <a href="">
    <img src="/html/img/my-bg.png" alt="">
    </a>
</div>
<div class="txt-inp">
    <form action="" method="post" id="demo_form">
        <input class="inp-gh" name="id" placeholder="工号" type="text" >
        <input class="inp-gh inp-xm" name="name" placeholder="姓名" type="text" >
        <input class="login-btn" type="button" value="登录" id="submit">
    </form>
</div>
</body>
{/block}
{block name="js"}
<script>
    $(function(){
        $('#submit').click(function () {
            var name = $('input[name=name]').val();
            var id = $('input[name=id]').val();
            if (name.length == 0 || id.length == 0) {
                layer.open({content: '工号和姓名不能为空',skin: 'msg',time: 2});
                return false;
            }
            var url = "{:url('login/index')}";
            var data = $('#demo_form').serialize();
            $.post(url, data, function (res) {
                if(res.code > 0){
                    layer.open({content: res.msg, skin: 'msg',time: 2});
                    setTimeout(function () {
                        location.href = "{:url('index/index')}";
                    }, 2000);
                }else{
                    layer.open({content: res.msg,skin: 'msg',time: 2});
                }
            });
        });

    })
</script>
{/block}
